package com.jhc.common.core.context;

import com.jhc.common.core.utils.StringUtils;
import com.jhc.common.core.web.page.PageDomain;

public class SqlParam {
    public static final ThreadLocal<PageDomain> sqlParamHolder = new ThreadLocal<>();

    public static void setParam(PageDomain pageDomain){
        sqlParamHolder.set(pageDomain);
    }

    public static String getWhereSql(){
        if(sqlParamHolder.get()!=null){
            return sqlParamHolder.get().getWhere();
        }
        return null;
    }



    public static Boolean isFilter(){
        return StringUtils.isNotEmpty(getWhereSql());
    }

    public static void clear(){
        sqlParamHolder.remove();
    }

}
